function HandleTableProducesMailing(gui, item, options) {
  this._gui = gui;
  this._item = item;
  this._options = options;
  this._produces = (options && options.produces) ? options.produces : [];
  this._user = (options && options.user) ? options.user : null;

  this._createElements();
}
HandleTableProducesMailing.prototype._createElements = function() {
  var tr, td, _self = this;
  DOMUtils.removeTableRows(this._gui.table, 1);

  if (this._item.length == 0) {
    tr = this._gui.table.insertRow(-1);
    td = tr.insertCell(-1);
    td.colSpan = 6;
    td.style.height = '40px';
    td.style.backgroundColor = '#fff';
    td.style.textAlign = 'center';
    td.style.borderRight = 'solid 1px #694247';
    td.style.borderBottom = 'solid 1px #694247';
    td.appendChild(document.createTextNode('N/A'));
  }
  
  this._gui.checkAll.style.display = (this._item.length != 0 && (this._user.type == '{{$smarty.const.USER_TYPE_MANAGER_ASSISTANT|escape:javascript}}' || this._user.type == '{{$smarty.const.USER_TYPE_MANAGER|escape:javascript}}' || this._user.type == '{{$smarty.const.USER_TYPE_ADMIN|escape:javascript}}')) ? 'inline' : 'none';
  
  this._gui.checkAll.onclick = function() { if (this.checked) {
                                              for (var i = 0, il = _self._item.length; i < il; i++) {
                                                var p = _self._item[i];
                                                _self._produces[_self._produces.length] = p;
                                              }
                                            } else {
                                              for (var i = 0, il = _self._item.length; i < il; i++) {
                                                var p = _self._item[i];
                                                MiscUtils.remove(_self._produces, p);
                                              }
                                            }
                                            _self._createElements();
                                          };
  
  for (var i = 0, il = this._item.length; i < il; i++) {
    var produce = this._item[i];
    
    tr = this._gui.table.insertRow(-1);
    new TableRowProduceMailing(tr, produce, this._options);
  }
};